3 * Updater for link tracking tables after a page edit.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 * See docs/deferred.txt
26 * @todo document (e.g. one-sentence top-level class description).
28 class LinksUpdate
extends SecondaryDBDataUpdate
{
33 var $mId, //!< Page ID of the article linked from
34 $mTitle, //!< Title object of the article linked from
35 $mParserOutput, //!< Whether to queue jobs for recursive update
36 $mLinks, //!< Map of title strings to IDs for the links in the document
37 $mImages, //!< DB keys of the images used, in the array key only
38 $mTemplates, //!< Map of title strings to IDs for the template references, including broken ones
39 $mExternals, //!< URLs of external links, array key only
40 $mCategories, //!< Map of category names to sort keys
41 $mInterlangs, //!< Map of language codes to titles
42 $mProperties, //!< Map of arbitrary name to value
43 $mRecursive; //!< Whether to queue jobs for recursive updates
49 * @param $title Title of the page we're updating
50 * @param $parserOutput ParserOutput: output from a full parse of this page
51 * @param $recursive Boolean: queue jobs for recursive updates?
53 function __construct( $title, $parserOutput, $recursive = true ) {
54 parent
::__construct( );
56 if ( !is_object( $title ) ) {
57 throw new MWException( "The calling convention to LinksUpdate::LinksUpdate() has changed. " .
58 "Please see Article::editUpdates() for an invocation example.\n" );
61 if ( !is_object( $parserOutput ) ) {
62 throw new MWException( "The calling convention to LinksUpdate::__construct() has changed. " .
63 "Please see WikiPage::doEditUpdates() for an invocation example.\n" );
66 $this->mTitle
= $title;
67 $this->mId
= $title->getArticleID();
69 $this->mParserOutput
= $parserOutput;
71 $this->mLinks
= $parserOutput->getLinks();
72 $this->mImages
= $parserOutput->getImages();
73 $this->mTemplates
= $parserOutput->getTemplates();
74 $this->mExternals
= $parserOutput->getExternalLinks();
75 $this->mCategories
= $parserOutput->getCategories();
76 $this->mProperties
= $parserOutput->getProperties();
77 $this->mInterwikis
= $parserOutput->getInterwikiLinks();
79 # Convert the format of the interlanguage links
80 # I didn't want to change it in the ParserOutput, because that array is passed all
81 # the way back to the skin, so either a skin API break would be required, or an
82 # inefficient back-conversion.
83 $ill = $parserOutput->getLanguageLinks();
84 $this->mInterlangs
= array();
85 foreach ( $ill as $link ) {
86 list( $key, $title ) = explode( ':', $link, 2 );
87 $this->mInterlangs
[$key] = $title;
90 foreach ( $this->mCategories
as &$sortkey ) {
91 # If the sortkey is longer then 255 bytes,
92 # it truncated by DB, and then doesn't get
93 # matched when comparing existing vs current
94 # categories, causing bug 25254.
95 # Also. substr behaves weird when given "".
96 if ( $sortkey !== '' ) {
97 $sortkey = substr( $sortkey, 0, 255 );
101 $this->mRecursive
= $recursive;
103 wfRunHooks( 'LinksUpdateConstructed', array( &$this ) );
107 * Update link tables with outgoing links from an updated article
109 public function doUpdate() {
110 global $wgUseDumbLinkUpdate;
112 wfRunHooks( 'LinksUpdate', array( &$this ) );
113 if ( $wgUseDumbLinkUpdate ) {
114 $this->doDumbUpdate();
116 $this->doIncrementalUpdate();
118 wfRunHooks( 'LinksUpdateComplete', array( &$this ) );
121 protected function doIncrementalUpdate() {
122 wfProfileIn( __METHOD__
);
125 $existing = $this->getExistingLinks();
126 $this->incrTableUpdate( 'pagelinks', 'pl', $this->getLinkDeletions( $existing ),
127 $this->getLinkInsertions( $existing ) );
130 $existing = $this->getExistingImages();
132 $imageDeletes = $this->getImageDeletions( $existing );
133 $this->incrTableUpdate( 'imagelinks', 'il', $imageDeletes,
134 $this->getImageInsertions( $existing ) );
136 # Invalidate all image description pages which had links added or removed
137 $imageUpdates = $imageDeletes +
array_diff_key( $this->mImages
, $existing );
138 $this->invalidateImageDescriptions( $imageUpdates );
141 $existing = $this->getExistingExternals();
142 $this->incrTableUpdate( 'externallinks', 'el', $this->getExternalDeletions( $existing ),
143 $this->getExternalInsertions( $existing ) );
146 $existing = $this->getExistingInterlangs();
147 $this->incrTableUpdate( 'langlinks', 'll', $this->getInterlangDeletions( $existing ),
148 $this->getInterlangInsertions( $existing ) );
150 # Inline interwiki links
151 $existing = $this->getExistingInterwikis();
152 $this->incrTableUpdate( 'iwlinks', 'iwl', $this->getInterwikiDeletions( $existing ),
153 $this->getInterwikiInsertions( $existing ) );
156 $existing = $this->getExistingTemplates();
157 $this->incrTableUpdate( 'templatelinks', 'tl', $this->getTemplateDeletions( $existing ),
158 $this->getTemplateInsertions( $existing ) );
161 $existing = $this->getExistingCategories();
163 $categoryDeletes = $this->getCategoryDeletions( $existing );
165 $this->incrTableUpdate( 'categorylinks', 'cl', $categoryDeletes,
166 $this->getCategoryInsertions( $existing ) );
168 # Invalidate all categories which were added, deleted or changed (set symmetric difference)
169 $categoryInserts = array_diff_assoc( $this->mCategories
, $existing );
170 $categoryUpdates = $categoryInserts +
$categoryDeletes;
171 $this->invalidateCategories( $categoryUpdates );
172 $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
175 $existing = $this->getExistingProperties();
177 $propertiesDeletes = $this->getPropertyDeletions( $existing );
179 $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes,
180 $this->getPropertyInsertions( $existing ) );
182 # Invalidate the necessary pages
183 $changed = $propertiesDeletes +
array_diff_assoc( $this->mProperties
, $existing );
184 $this->invalidateProperties( $changed );
186 # Refresh links of all pages including this page
187 # This will be in a separate transaction
188 if ( $this->mRecursive
) {
189 $this->queueRecursiveJobs();
192 wfProfileOut( __METHOD__
);
196 * Link update which clears the previous entries and inserts new ones
197 * May be slower or faster depending on level of lock contention and write speed of DB
198 * Also useful where link table corruption needs to be repaired, e.g. in refreshLinks.php
200 protected function doDumbUpdate() {
201 wfProfileIn( __METHOD__
);
203 # Refresh category pages and image description pages
204 $existing = $this->getExistingCategories();
205 $categoryInserts = array_diff_assoc( $this->mCategories
, $existing );
206 $categoryDeletes = array_diff_assoc( $existing, $this->mCategories
);
207 $categoryUpdates = $categoryInserts +
$categoryDeletes;
208 $existing = $this->getExistingImages();
209 $imageUpdates = array_diff_key( $existing, $this->mImages
) +
array_diff_key( $this->mImages
, $existing );
211 $this->dumbTableUpdate( 'pagelinks', $this->getLinkInsertions(), 'pl_from' );
212 $this->dumbTableUpdate( 'imagelinks', $this->getImageInsertions(), 'il_from' );
213 $this->dumbTableUpdate( 'categorylinks', $this->getCategoryInsertions(), 'cl_from' );
214 $this->dumbTableUpdate( 'templatelinks', $this->getTemplateInsertions(), 'tl_from' );
215 $this->dumbTableUpdate( 'externallinks', $this->getExternalInsertions(), 'el_from' );
216 $this->dumbTableUpdate( 'langlinks', $this->getInterlangInsertions(),'ll_from' );
217 $this->dumbTableUpdate( 'iwlinks', $this->getInterwikiInsertions(),'iwl_from' );
218 $this->dumbTableUpdate( 'page_props', $this->getPropertyInsertions(), 'pp_page' );
220 # Update the cache of all the category pages and image description
221 # pages which were changed, and fix the category table count
222 $this->invalidateCategories( $categoryUpdates );
223 $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
224 $this->invalidateImageDescriptions( $imageUpdates );
226 # Refresh links of all pages including this page
227 # This will be in a separate transaction
228 if ( $this->mRecursive
) {
229 $this->queueRecursiveJobs();
232 wfProfileOut( __METHOD__
);
235 function queueRecursiveJobs() {
236 global $wgUpdateRowsPerJob;
237 wfProfileIn( __METHOD__
);
239 $cache = $this->mTitle
->getBacklinkCache();
240 $batches = $cache->partition( 'templatelinks', $wgUpdateRowsPerJob );
242 wfProfileOut( __METHOD__
);
246 foreach ( $batches as $batch ) {
247 list( $start, $end ) = $batch;
249 'table' => 'templatelinks',
253 $jobs[] = new RefreshLinksJob2( $this->mTitle
, $params );
255 Job
::batchInsert( $jobs );
257 wfProfileOut( __METHOD__
);
263 function invalidateCategories( $cats ) {
264 $this->invalidatePages( NS_CATEGORY
, array_keys( $cats ) );
268 * Update all the appropriate counts in the category table.
269 * @param $added array associative array of category name => sort key
270 * @param $deleted array associative array of category name => sort key
272 function updateCategoryCounts( $added, $deleted ) {
273 $a = WikiPage
::factory( $this->mTitle
);
274 $a->updateCategoryCounts(
275 array_keys( $added ), array_keys( $deleted )
282 function invalidateImageDescriptions( $images ) {
283 $this->invalidatePages( NS_FILE
, array_keys( $images ) );
291 private function dumbTableUpdate( $table, $insertions, $fromField ) {
292 $this->mDb
->delete( $table, array( $fromField => $this->mId
), __METHOD__
);
293 if ( count( $insertions ) ) {
294 # The link array was constructed without FOR UPDATE, so there may
295 # be collisions. This may cause minor link table inconsistencies,
296 # which is better than crippling the site with lock contention.
297 $this->mDb
->insert( $table, $insertions, __METHOD__
, array( 'IGNORE' ) );
302 * Update a table by doing a delete query then an insert query
308 function incrTableUpdate( $table, $prefix, $deletions, $insertions ) {
309 if ( $table == 'page_props' ) {
310 $fromField = 'pp_page';
312 $fromField = "{$prefix}_from";
314 $where = array( $fromField => $this->mId
);
315 if ( $table == 'pagelinks' ||
$table == 'templatelinks' ||
$table == 'iwlinks' ) {
316 if ( $table == 'iwlinks' ) {
317 $baseKey = 'iwl_prefix';
319 $baseKey = "{$prefix}_namespace";
321 $clause = $this->mDb
->makeWhereFrom2d( $deletions, $baseKey, "{$prefix}_title" );
328 if ( $table == 'langlinks' ) {
329 $toField = 'll_lang';
330 } elseif ( $table == 'page_props' ) {
331 $toField = 'pp_propname';
333 $toField = $prefix . '_to';
335 if ( count( $deletions ) ) {
336 $where[] = "$toField IN (" . $this->mDb
->makeList( array_keys( $deletions ) ) . ')';
342 $this->mDb
->delete( $table, $where, __METHOD__
);
344 if ( count( $insertions ) ) {
345 $this->mDb
->insert( $table, $insertions, __METHOD__
, 'IGNORE' );
350 * Get an array of pagelinks insertions for passing to the DB
351 * Skips the titles specified by the 2-D array $existing
352 * @param $existing array
355 private function getLinkInsertions( $existing = array() ) {
357 foreach( $this->mLinks
as $ns => $dbkeys ) {
358 $diffs = isset( $existing[$ns] )
359 ?
array_diff_key( $dbkeys, $existing[$ns] )
361 foreach ( $diffs as $dbk => $id ) {
363 'pl_from' => $this->mId
,
364 'pl_namespace' => $ns,
373 * Get an array of template insertions. Like getLinkInsertions()
374 * @param $existing array
377 private function getTemplateInsertions( $existing = array() ) {
379 foreach( $this->mTemplates
as $ns => $dbkeys ) {
380 $diffs = isset( $existing[$ns] ) ?
array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
381 foreach ( $diffs as $dbk => $id ) {
383 'tl_from' => $this->mId
,
384 'tl_namespace' => $ns,
393 * Get an array of image insertions
394 * Skips the names specified in $existing
395 * @param $existing array
398 private function getImageInsertions( $existing = array() ) {
400 $diffs = array_diff_key( $this->mImages
, $existing );
401 foreach( $diffs as $iname => $dummy ) {
403 'il_from' => $this->mId
,
411 * Get an array of externallinks insertions. Skips the names specified in $existing
412 * @param $existing array
415 private function getExternalInsertions( $existing = array() ) {
417 $diffs = array_diff_key( $this->mExternals
, $existing );
418 foreach( $diffs as $url => $dummy ) {
419 foreach( wfMakeUrlIndexes( $url ) as $index ) {
421 'el_from' => $this->mId
,
423 'el_index' => $index,
431 * Get an array of category insertions
433 * @param $existing array mapping existing category names to sort keys. If both
434 * match a link in $this, the link will be omitted from the output
438 private function getCategoryInsertions( $existing = array() ) {
439 global $wgContLang, $wgCategoryCollation;
440 $diffs = array_diff_assoc( $this->mCategories
, $existing );
442 foreach ( $diffs as $name => $prefix ) {
443 $nt = Title
::makeTitleSafe( NS_CATEGORY
, $name );
444 $wgContLang->findVariantLink( $name, $nt, true );
446 if ( $this->mTitle
->getNamespace() == NS_CATEGORY
) {
448 } elseif ( $this->mTitle
->getNamespace() == NS_FILE
) {
454 # Treat custom sortkeys as a prefix, so that if multiple
455 # things are forced to sort as '*' or something, they'll
456 # sort properly in the category rather than in page_id
458 $sortkey = Collation
::singleton()->getSortKey(
459 $this->mTitle
->getCategorySortkey( $prefix ) );
462 'cl_from' => $this->mId
,
464 'cl_sortkey' => $sortkey,
465 'cl_timestamp' => $this->mDb
->timestamp(),
466 'cl_sortkey_prefix' => $prefix,
467 'cl_collation' => $wgCategoryCollation,
475 * Get an array of interlanguage link insertions
477 * @param $existing Array mapping existing language codes to titles
481 private function getInterlangInsertions( $existing = array() ) {
482 $diffs = array_diff_assoc( $this->mInterlangs
, $existing );
484 foreach( $diffs as $lang => $title ) {
486 'll_from' => $this->mId
,
495 * Get an array of page property insertions
496 * @param $existing array
499 function getPropertyInsertions( $existing = array() ) {
500 $diffs = array_diff_assoc( $this->mProperties
, $existing );
502 foreach ( $diffs as $name => $value ) {
504 'pp_page' => $this->mId
,
505 'pp_propname' => $name,
506 'pp_value' => $value,
513 * Get an array of interwiki insertions for passing to the DB
514 * Skips the titles specified by the 2-D array $existing
515 * @param $existing array
518 private function getInterwikiInsertions( $existing = array() ) {
520 foreach( $this->mInterwikis
as $prefix => $dbkeys ) {
521 $diffs = isset( $existing[$prefix] ) ?
array_diff_key( $dbkeys, $existing[$prefix] ) : $dbkeys;
522 foreach ( $diffs as $dbk => $id ) {
524 'iwl_from' => $this->mId
,
525 'iwl_prefix' => $prefix,
534 * Given an array of existing links, returns those links which are not in $this
535 * and thus should be deleted.
536 * @param $existing array
539 private function getLinkDeletions( $existing ) {
541 foreach ( $existing as $ns => $dbkeys ) {
542 if ( isset( $this->mLinks
[$ns] ) ) {
543 $del[$ns] = array_diff_key( $existing[$ns], $this->mLinks
[$ns] );
545 $del[$ns] = $existing[$ns];
552 * Given an array of existing templates, returns those templates which are not in $this
553 * and thus should be deleted.
554 * @param $existing array
557 private function getTemplateDeletions( $existing ) {
559 foreach ( $existing as $ns => $dbkeys ) {
560 if ( isset( $this->mTemplates
[$ns] ) ) {
561 $del[$ns] = array_diff_key( $existing[$ns], $this->mTemplates
[$ns] );
563 $del[$ns] = $existing[$ns];
570 * Given an array of existing images, returns those images which are not in $this
571 * and thus should be deleted.
572 * @param $existing array
575 private function getImageDeletions( $existing ) {
576 return array_diff_key( $existing, $this->mImages
);
580 * Given an array of existing external links, returns those links which are not
581 * in $this and thus should be deleted.
582 * @param $existing array
585 private function getExternalDeletions( $existing ) {
586 return array_diff_key( $existing, $this->mExternals
);
590 * Given an array of existing categories, returns those categories which are not in $this
591 * and thus should be deleted.
592 * @param $existing array
595 private function getCategoryDeletions( $existing ) {
596 return array_diff_assoc( $existing, $this->mCategories
);
600 * Given an array of existing interlanguage links, returns those links which are not
601 * in $this and thus should be deleted.
602 * @param $existing array
605 private function getInterlangDeletions( $existing ) {
606 return array_diff_assoc( $existing, $this->mInterlangs
);
610 * Get array of properties which should be deleted.
611 * @param $existing array
614 function getPropertyDeletions( $existing ) {
615 return array_diff_assoc( $existing, $this->mProperties
);
619 * Given an array of existing interwiki links, returns those links which are not in $this
620 * and thus should be deleted.
621 * @param $existing array
624 private function getInterwikiDeletions( $existing ) {
626 foreach ( $existing as $prefix => $dbkeys ) {
627 if ( isset( $this->mInterwikis
[$prefix] ) ) {
628 $del[$prefix] = array_diff_key( $existing[$prefix], $this->mInterwikis
[$prefix] );
630 $del[$prefix] = $existing[$prefix];
637 * Get an array of existing links, as a 2-D array
641 private function getExistingLinks() {
642 $res = $this->mDb
->select( 'pagelinks', array( 'pl_namespace', 'pl_title' ),
643 array( 'pl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
645 foreach ( $res as $row ) {
646 if ( !isset( $arr[$row->pl_namespace
] ) ) {
647 $arr[$row->pl_namespace
] = array();
649 $arr[$row->pl_namespace
][$row->pl_title
] = 1;
655 * Get an array of existing templates, as a 2-D array
659 private function getExistingTemplates() {
660 $res = $this->mDb
->select( 'templatelinks', array( 'tl_namespace', 'tl_title' ),
661 array( 'tl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
663 foreach ( $res as $row ) {
664 if ( !isset( $arr[$row->tl_namespace
] ) ) {
665 $arr[$row->tl_namespace
] = array();
667 $arr[$row->tl_namespace
][$row->tl_title
] = 1;
673 * Get an array of existing images, image names in the keys
677 private function getExistingImages() {
678 $res = $this->mDb
->select( 'imagelinks', array( 'il_to' ),
679 array( 'il_from' => $this->mId
), __METHOD__
, $this->mOptions
);
681 foreach ( $res as $row ) {
682 $arr[$row->il_to
] = 1;
688 * Get an array of existing external links, URLs in the keys
692 private function getExistingExternals() {
693 $res = $this->mDb
->select( 'externallinks', array( 'el_to' ),
694 array( 'el_from' => $this->mId
), __METHOD__
, $this->mOptions
);
696 foreach ( $res as $row ) {
697 $arr[$row->el_to
] = 1;
703 * Get an array of existing categories, with the name in the key and sort key in the value.
707 private function getExistingCategories() {
708 $res = $this->mDb
->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ),
709 array( 'cl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
711 foreach ( $res as $row ) {
712 $arr[$row->cl_to
] = $row->cl_sortkey_prefix
;
718 * Get an array of existing interlanguage links, with the language code in the key and the
719 * title in the value.
723 private function getExistingInterlangs() {
724 $res = $this->mDb
->select( 'langlinks', array( 'll_lang', 'll_title' ),
725 array( 'll_from' => $this->mId
), __METHOD__
, $this->mOptions
);
727 foreach ( $res as $row ) {
728 $arr[$row->ll_lang
] = $row->ll_title
;
734 * Get an array of existing inline interwiki links, as a 2-D array
735 * @return array (prefix => array(dbkey => 1))
737 protected function getExistingInterwikis() {
738 $res = $this->mDb
->select( 'iwlinks', array( 'iwl_prefix', 'iwl_title' ),
739 array( 'iwl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
741 foreach ( $res as $row ) {
742 if ( !isset( $arr[$row->iwl_prefix
] ) ) {
743 $arr[$row->iwl_prefix
] = array();
745 $arr[$row->iwl_prefix
][$row->iwl_title
] = 1;
751 * Get an array of existing categories, with the name in the key and sort key in the value.
755 private function getExistingProperties() {
756 $res = $this->mDb
->select( 'page_props', array( 'pp_propname', 'pp_value' ),
757 array( 'pp_page' => $this->mId
), __METHOD__
, $this->mOptions
);
759 foreach ( $res as $row ) {
760 $arr[$row->pp_propname
] = $row->pp_value
;
766 * Return the title object of the page being updated
769 public function getTitle() {
770 return $this->mTitle
;
774 * Returns parser output
776 * @return ParserOutput
778 public function getParserOutput() {
779 return $this->mParserOutput
;
783 * Return the list of images used as generated by the parser
786 public function getImages() {
787 return $this->mImages
;
791 * Invalidate any necessary link lists related to page property changes
794 private function invalidateProperties( $changed ) {
795 global $wgPagePropLinkInvalidations;
797 foreach ( $changed as $name => $value ) {
798 if ( isset( $wgPagePropLinkInvalidations[$name] ) ) {
799 $inv = $wgPagePropLinkInvalidations[$name];
800 if ( !is_array( $inv ) ) {
801 $inv = array( $inv );
803 foreach ( $inv as $table ) {
804 $update = new HTMLCacheUpdate( $this->mTitle
, $table );
813 * Update object handling the cleanup of links tables after a page was deleted.
815 class LinksDeletionUpdate
extends SecondaryDBDataUpdate
{
820 var $mWikiPage; //!< WikiPage the wikipage that was deleted
826 * @param $title Title of the page we're updating
827 * @param $parserOutput ParserOutput: output from a full parse of this page
828 * @param $recursive Boolean: queue jobs for recursive updates?
830 function __construct( WikiPage
$page ) {
831 parent
::__construct( );
833 $this->mPage
= $page;
837 * Do some database updates after deletion
839 public function doUpdate() {
840 $title = $this->mPage
->getTitle();
841 $id = $this->mPage
->getId();
843 # Delete restrictions for it
844 $this->mDb
->delete( 'page_restrictions', array ( 'pr_page' => $id ), __METHOD__
);
846 # Fix category table counts
848 $res = $this->mDb
->select( 'categorylinks', 'cl_to', array( 'cl_from' => $id ), __METHOD__
);
850 foreach ( $res as $row ) {
851 $cats [] = $row->cl_to
;
854 $this->mPage
->updateCategoryCounts( array(), $cats );
856 # If using cascading deletes, we can skip some explicit deletes
857 if ( !$this->mDb
->cascadingDeletes() ) {
858 $this->mDb
->delete( 'revision', array( 'rev_page' => $id ), __METHOD__
);
860 # Delete outgoing links
861 $this->mDb
->delete( 'pagelinks', array( 'pl_from' => $id ), __METHOD__
);
862 $this->mDb
->delete( 'imagelinks', array( 'il_from' => $id ), __METHOD__
);
863 $this->mDb
->delete( 'categorylinks', array( 'cl_from' => $id ), __METHOD__
);
864 $this->mDb
->delete( 'templatelinks', array( 'tl_from' => $id ), __METHOD__
);
865 $this->mDb
->delete( 'externallinks', array( 'el_from' => $id ), __METHOD__
);
866 $this->mDb
->delete( 'langlinks', array( 'll_from' => $id ), __METHOD__
);
867 $this->mDb
->delete( 'iwlinks', array( 'iwl_from' => $id ), __METHOD__
);
868 $this->mDb
->delete( 'redirect', array( 'rd_from' => $id ), __METHOD__
);
869 $this->mDb
->delete( 'page_props', array( 'pp_page' => $id ), __METHOD__
);
872 # If using cleanup triggers, we can skip some manual deletes
873 if ( !$this->mDb
->cleanupTriggers() ) {
874 # Clean up recentchanges entries...
875 $this->mDb
->delete( 'recentchanges',
876 array( 'rc_type != ' . RC_LOG
,
877 'rc_namespace' => $title->getNamespace(),
878 'rc_title' => $title->getDBkey() ),
880 $this->mDb
->delete( 'recentchanges',
881 array( 'rc_type != ' . RC_LOG
, 'rc_cur_id' => $id ),